package cn.wsalix.biz.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.anlaser.service.impl.ParentServiceImpl;
import cn.wsalix.biz.entity.Activity;
import cn.wsalix.biz.form.ActivityForm;
import cn.wsalix.biz.repository.ActivityRepository;
import cn.wsalix.biz.service.ActivityService;
import cn.anlaser.utils.SearchFilter;

@Service("activityService")
public class ActivityServiceImpl extends
		ParentServiceImpl<ActivityForm,ActivityRepository, Activity> implements
		ActivityService {
	@Autowired
	private ActivityRepository activityRepository;

	@Override
	public String module() {
		return "/biz/activity";
	}

	@Override
	public ActivityRepository getRepository() {
		return activityRepository;
	}

	@Override
	public Class<Activity> getEntityClazz() {
		return Activity.class;
	}

	@Override
	public Map<String, SearchFilter> buildByForm(ActivityForm form) {
		Map<String, Object> searchParams = new HashMap<String, Object>();
		Map<String, SearchFilter> filters = SearchFilter.parse(searchParams);
		/*if (form.getParentId() != null && form.getParentId() != 0) {
			filters.put("parent.id", new SearchFilter("parent.id",
					Operator.EQ, form.getParentId()));
		}*/
		return filters;
	}

}
